/**
 * 
 * @author htqw
 * @param {import("mysql2").Connection} connetion 
 * @param {string} table 
 * @param {string | undefined} where 
 * @returns 
 */

export default function deleteTableRow(connetion, table, where) {
    return new Promise((resolve, reject) => {
        connetion.query(`DELETE FROM ${table} ${where?`WHERE ${where}`:''}`, (err, result) => {
            if (err) 
                reject(err);
            else 
                resolve(result);
        });
    })
}